package MallSecret

import (
	CoreSQL "gitee.com/fotomxq/weeekj_core/v5/core/sql"
	Router2SystemConfig "gitee.com/fotomxq/weeekj_core/v5/router2/system_config"
)

type ArgsDeleteSecond struct {
	//组织ID
	OrgID int64 `db:"org_id" json:"orgID"`
	//秒杀商品id
	SecondID int64 `db:"second_id" json:"secondID"`
}

// DeleteSecond 根据条件删除会员购买商品的统计
func DeleteSecond(args *ArgsDeleteSecond) (err error) {
	_, err = CoreSQL.DeleteAllSoft(Router2SystemConfig.MainDB.DB, "mall_second",
		"org_id =:org_id AND id =:second_id",
		args)
	if err != nil {
		return
	}
	//反馈
	return
}

// DeleteSecondByDate 根据日期删除商品
func DeleteSecondByDate(date string) (err error) {
	_, err = CoreSQL.DeleteAll(Router2SystemConfig.MainDB.DB, "mall_second", "second_date = :second_date ", map[string]interface{}{
		"second_date": date,
	})
	if err != nil {
		return
	}
	//反馈
	return
}
